# -*- coding:utf-8 -*-
'''
reference: http://www.python-course.eu/python3_formatted_output.php

'''

print('Art: %5d, Price per Unit: %8.2f' % (453,59.058))

print('Art: %3d, Price per Unit: %5.2f' % (453,59.045))

print('Art: %7d, Price per Unit: %5.2f' % (453,59.053))

'''%8.2f 整数部分+小数点+小数部分的总长度为8，不够8位的前面以空格补充， 
         小数部分保留2位小数，采取四舍五入的计算方式'''
         
         
print("Second argument: {1:4.1f}, first one: {0:7.2f}".format(47.42,11.234))

'''{1:4.1f}中，1表示第二个参数，4.1f表示格式'''

print("Art: {a:5d},  Price: {p:8.2f}".format(a=453, p=59.058))

print('Art: {0:5d}, price'.format(453) + ':'+'{0:8.2f}'.format(59.056))
